#pragma once
#include "DXUT.h"

class CRole:public IUpdateable
{
public:
	CRole(const TCHAR *resName,const TCHAR *szFile);
	~CRole(void);

public:
	void UpdateByWorldMatrix(const D3DXMATRIX * pWorld,const D3DXVECTOR3&vOffset);
	void SetRolePos(D3DXVECTOR3* pvEyePt, D3DXVECTOR3* pvLookatPt);
	D3DXVECTOR3 GetRolePos(){return r_pos;};

	void setRoleScale(D3DXVECTOR3* r_scale);
	void setRoleRoate(D3DXVECTOR3* r_Roate);


	void DefaultHandle(float t);

	void WalkAhead(float dz)
	{
		r_pos+=vWorldAhead*dz;
	}
	void WalkRight(float dx)
	{
		r_pos+=vWorldRight*dx;
	}
	void WalkUp(float dy)
	{
		r_pos+=vWorldUp*dy;
	}
	void Yaw(float y);

	void Render(float fElapsedTime);
	virtual void OnUpdate( double fTime, float fElapsedTime );
private:
	CMesh * pMesh;
	CMeshInstance  * pMeshInstance;

	D3DXVECTOR3 r_pos;					//role position
	D3DXVECTOR3 r_vLookAt;              // LookAt position
	D3DXVECTOR3 vWorldUp;
	D3DXVECTOR3 vWorldAhead;
	D3DXVECTOR3 vWorldRight; 
	D3DXMATRIX r_rView; 
	D3DXMATRIX m_mViewInverse;
	D3DXVECTOR3 r_scale;
};